<?php
namespace App\Http\Controllers\ApiWx\Mys;

use App\DBs\VideoDB;
use Illuminate\Http\Request;

class VideoController extends BaseController
{
    //视频

    protected $db;

    public function __construct()
    {
        parent::__construct();
        $this->db = new VideoDB();
    }

    /**
     * 视频列表
     */
    public function getIndex(Request $request)
    {
        $wx = $request->post('wx','');
        $resDb = $this->db->getMyIndex($wx);
        if ($resDb['code']!=0) {
            return $this->toWxJson(-3);
        }
        $items = $resDb['data']; $total = $resDb['total'];
        return $this->toWxJson(0,$items,$total);
    }

    /**
     * 喜欢列表
     */
    public function getLikeIndex(Request $request)
    {
        $wx = $request->post('wx','');
        $resDb = $this->db->getMyLikeIndex($wx);
        if ($resDb['code']!=0) {
            return $this->toWxJson(-3);
        }
        $items = $resDb['data']; $total = $resDb['total'];
        return $this->toWxJson(0,$items,$total);
    }

    /**
     * 评论列表
     */
    public function getPlIndex(Request $request)
    {
        $wx = $request->post('wx','');
        $resDb = $this->db->getMyPlIndex($wx);
        if ($resDb['code']!=0) {
            return $this->toWxJson(-3);
        }
        $items = $resDb['data']; $total = $resDb['total'];
        return $this->toWxJson(0,$items,$total);
    }

    /**
     * 评论列表2
     */
    public function getPlOne(Request $request)
    {
        $wx = $request->post('wx','');
        $vid = $request->post('vid',0);
        $resDb = $this->db->getMyPlOne($wx,$vid);
        if ($resDb['code']!=0) {
            return $this->toWxJson(-3);
        }
        $items = $resDb['data']; $total = $resDb['total'];
        return $this->toWxJson(0,$items,$total);
    }

    /**
     * 分享列表
     */
    public function getFxIndex(Request $request)
    {
        $wx = $request->post('wx','');
        $resDb = $this->db->getMyFxIndex($wx);
        if ($resDb['code']!=0) {
            return $this->toWxJson(-3);
        }
        $items = $resDb['data']; $total = $resDb['total'];
        return $this->toWxJson(0,$items,$total);
    }

    /**
     * 分享列表2
     */
    public function getFxOne(Request $request)
    {
        $wx = $request->post('wx','');
        $vid = $request->post('vid',0);
        $resDb = $this->db->getMyFxOne($wx,$vid);
        if ($resDb['code']!=0) {
            return $this->toWxJson(-3);
        }
        $items = $resDb['data']; $total = $resDb['total'];
        return $this->toWxJson(0,$items,$total);
    }
}